<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>文章类型列表</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" crossorigin="anonymous">
    <link rel="stylesheet" th:href="@{/css/articlelist.css}">
</head>
<body class="bg-light">
<nav class="navbar navbar-expand-lg custom-navbar mb-4 rounded">
    <div class="container-fluid">
        <a class="navbar-brand text-white" href="#">MYBLOG</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav ms-auto">
                <li class="nav-item me-3">
                    <p class="nav-link active text-white">欢迎您</span></p>
                </li>
                <li class="nav-item me-3">
                    <a class="nav-link text-white" th:href="@{/articletype/page?pageIndex=0}">文章类型</a>
                </li>
                <li class="nav-item me-3">
                    <a class="nav-link text-white" th:href="@{/article/findAll}">文章列表</a>
                </li>
                <li class="nav-item me-3">
                    <a class="nav-link text-white" th:href="@{/user/findAll}">用户列表</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-white" th:href="@{/logout}">退出</a>
                </li>
            </ul>
        </div>
    </div>
</nav>

<div class="container mt-5">
    <h1 class="text-center mb-4">文章列表
        <a th:href="@{/}" class="btn btn-info ms-2">返回主页</a>
    </h1>
    <hr class="my-4">

    <div class="row mb-3">
        <div class="col-sm-4 text-start">
            <a href="/toAdd" th:href="@{/article/toAdd}" class="btn btn-info">新增</a>
        </div>
        <div class="col-sm-4"></div>
        <div class="col-sm-4 text-end">
            <a href="#" th:href="@{/article/page?pageIndex=0}" class="btn btn-info">首页</a>
            <a href="#" th:href="@{/article/page(pageIndex=${pre})}" class="btn btn-info">上页</a>
            <a href="#" th:href="@{/article/page(pageIndex=${next})}" class="btn btn-info">下页</a>
            <a href="#" th:href="@{/article/page(pageIndex=${page.getTotalPages()-1})}" class="btn btn-info">末页</a>
        </div>
    </div>

    <div class="table-responsive">
        <table class="table table-hover shadow-sm rounded">
            <thead>
            <tr>
                <th>编号</th>
                <th>文章标题</th>
                <th>文章类型</th>
                <th>发布时间</th>
                <th>发布人</th>
                <th>Edit</th>
                <th>Delete</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="article, articleStat : ${page.getContent()}">
                <th scope="row" th:text="${articleStat.index + 1}">1</th>
                <td><a th:href="@{/article/show(id=${article.id})}" th:text="${article.title}">neo</a></td>
                <td th:text="${article.articletype.type}">neo</td>
                <td th:text="${#dates.format(article.pubDate, 'yyyy/MM/dd')}">Otto</td>
                <td th:text="${article.user.username}">6</td>
                <td><a th:href="@{/article/toEdit(id=${article.id})}" class="btn btn-warning btn-sm">edit</a></td>
                <td><a th:href="@{/article/delete(id=${article.id})}" class="btn btn-danger btn-sm">delete</a></td>
            </tr>
            </tbody>
        </table>
    </div>

</div>

<footer class="footer mt-4">
    <div class="container text-center py-3">
        <p>&copy; 2024 MYBLOG. All rights reserved.</p>
    </div>
</footer>
</body>
</html>